package com.baomidou.springwind.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.springwind.entity.Project;
import com.baomidou.springwind.mapper.ProjectServiceDao;
import com.baomidou.springwind.service.ProjectService;
import com.baomidou.springwind.service.support.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * User 表数据服务层接口实现类
 */
@Service
public class ProjectServiceImpl extends BaseServiceImpl<ProjectServiceDao, Project> implements ProjectService {

    @Autowired
    private ProjectServiceDao projectServiceDao;

    @Override
    public List<Project> getUserAllProjects() {
        EntityWrapper<Project> wrapper = new EntityWrapper<Project>();
        wrapper.eq("operator_id", getCurrentUserId());
        wrapper.in("state", Arrays.asList("1", "2"));
        wrapper.orderBy("createTime");
        return projectServiceDao.selectList(wrapper);
    }
}